package demo;

/**
 * Created with IntelliJ IDEA.
 * Description: 泛型
 * Author:  LiuTao
 * Version: 1.0
 * Date:    2023-09-17  21:10
 */
class MyList<T> {
    public Object[] object = new Object[10];
    public void setVal(int pos, T val) {
        this.object[pos] = val;
    }

    public T getPos(int pos) {
        return (T) this.object[pos];
    }

}
public class Test {
    public static void main(String[] args) {
        MyList<Integer> myList = new MyList<>();
        myList.setVal(0,999);
        System.out.println(myList.getPos(0));
    }
}
